/*
   FieldVis - A Tool for Visualizing Astrophysical Magnetohydrodynamic Flow
   
   Copyright (C) 2006 - 2008     FieldVis Development Team
  
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
  
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
  
   You should have received a copy of the GNU General Public License along
   with this program; if not, write to the Free Software Foundation, Inc.,
   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

   File     : Vector3D.h
   Author   : Blayne Field
   
   Purpose  : Definition header file for the Vector3D class.  This class
              just holds a 3D vector
*/

#ifndef VECTOR3D_H
#define VECTOR3D_H

#include <iostream>
#include <cmath>


class Vector3D
{
public:
   Vector3D() : x(0), y(0), z(0) {}
   Vector3D(float px, float py, float pz) : x(px), y(py), z(pz) {}

   void Normalize();

   // access methods
   float GetX() const { return x;}
   float GetY() const { return y;}
   float GetZ() const { return z;}

   float Norm() const;

   // mutator methods
   void SetX(float px) { x = px;}
   void SetY(float py) { y = py;}
   void SetZ(float pz) { z = pz;}

   // some overloaded operators
   Vector3D operator+(const Vector3D toAdd);
   Vector3D operator-(const Vector3D toSub);
   Vector3D operator*(float);
   Vector3D operator/(float);
   Vector3D & operator=(const Vector3D & toCopy);

   Vector3D Cross(const Vector3D &rhs) const;
   float Dot(const Vector3D &rhs) const;

private:

   float x;
   float y;
   float z;
};

std::ostream & operator<<(std::ostream & out, Vector3D & p);

#endif

